package cn.wolfcode.cloud.shop.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

public class CommonExceptionAdvice {
    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public Result hanlder(BusinessException e) {
        e.getMessage();
        return Result.error(e.getCodeMsg());
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result hanlderDefaultException(Exception e) {
        e.printStackTrace();
        return Result.defaultError();
    }
}